home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 9 / AMUG BBS in a Box Volume IX (August 1993) (MacWizards).iso / Files / Prog / Q-R / REdExamples.cpt / Examples / CExamples / ResEd68K.a / ResEd68K.a
Encoding:
Text File  |  1988-08-01  |  5.4 KB  |  239 lines  |  [TEXT/MPS ]

  1. ; File ResEd68k.a
  2. ;
  3. ; Copyright Apple Computer, Inc. 1984-1988
  4. ; All rights reserved.
  5.  
  6. ; This is the standard interface for a Resource Standard Code segment for use
  7. ; by the resource editor.  The main resource editor will dispatch to this code
  8. ; when the user opens the respective type for editing.    Dispatches will also
  9. ; occur with menu commands and events for this window.    This code should be
  10. ; included in the resource editor file under type RSSC with any unique ID.    
  11. ; It's resource name should consist of the type it's willing to edit.
  12. ; Each code segment MUST have a window and its kind MUST be the ID of the code
  13. ; and the refcon usually contains the handle to the instance of the object
  14. ; who's owned by the code.  On activate/deactivate events, the code can put up
  15. ; and remove any menus if desired.
  16.  
  17. ; The standard routines are:
  18.  
  19. ;        EditBirth( thing:Handle; parent: ParentHandle );
  20.  
  21. ;        PickBirth( t: ResType; parent: ParentHandle );
  22.  
  23. ;        DoMenu( menu, item: INTEGER; object: Handle );
  24.  
  25. ;        DoEvent( VAR evt: EvtRecord; object: Handle );
  26.  
  27.  
  28.  
  29.             STRING        ASIS
  30.  
  31.             PRINT        OFF
  32.             INCLUDE     'QuickEqu.a'
  33.             INCLUDE     'ToolEqu.a'
  34.             INCLUDE     'SysEqu.a'
  35.             INCLUDE     'Traps.a'
  36.             PRINT        ON
  37.  
  38. StdRSC        PROC        EXPORT
  39.  
  40.             IMPORT        PickBirth
  41.             IMPORT        EditBirth
  42.             IMPORT        DoEvent
  43.             IMPORT        DoMenu
  44.             IMPORT        DoInfoUpdate
  45.  
  46.             EXPORT        StdHeader
  47.  
  48.             EXPORT        ResEdID
  49.             EXPORT        ResEditRes
  50.             EXPORT        ResEverest
  51.             EXPORT        CallPBirth
  52.             EXPORT        CallEBirth
  53.             EXPORT        CallMenu
  54.             EXPORT        CallEvent
  55.             EXPORT        CallInfoUpdate
  56.             EXPORT        Passmenu
  57.  
  58. StdHeader
  59.             DC.L        ('RSSC')
  60.  
  61.             DC.W        JEditBirth-StdHeader
  62.             DC.W        JPickBirth-StdHeader
  63.             DC.W        JDoEvent-StdHeader
  64.             DC.W        JDoMenu-StdHeader
  65.             DC.W        JDoInfoUpdate-StdHeader
  66.             DC.W        0
  67.             DC.W        0
  68.             DC.W        0
  69.             DC.W        0
  70. JEditBirth
  71.             JMP         EditBirth
  72. JPickBirth
  73.             JMP         PickBirth
  74. JDoEvent
  75.             JMP         DoEvent
  76. JDoMenu
  77.             JMP         DoMenu
  78. JDoInfoUpdate
  79.             JMP         DoInfoUpdate
  80.  
  81. ;-----------------------------------------------------------------------------------
  82. ;
  83. ;    CallEBirth(thing:Handle;parent:ParentHandle;id:Integer);
  84. ;    CallPBirth(thing:Handle;parent:ParentHandle;id:Integer);
  85. ;
  86. ;-----------------------------------------------------------------------------------
  87. CallEBirth    MOVE.L        (SP)+,A0
  88.             MOVE.L        #0,-(SP)
  89.             BRA.S        CallIt
  90.  
  91. CallPBirth    MOVE.L        (SP)+,A0
  92.             MOVE.L        #2,-(SP)
  93.  
  94. CallIt
  95.             MOVE.L        A0,-(SP)
  96.  
  97. ; Calls back to main program
  98. ;                EXPORT        CallEBirth
  99. ;                EXPORT        CallPBirth
  100.                 
  101.                 EXPORT        CallEvent
  102.                 EXPORT        CallMenu
  103.                 EXPORT        CallInfoUpdate
  104.  
  105.                 EXPORT        PassMenu
  106.  
  107.                 EXPORT        ResEditRes
  108.                 EXPORT        ResEverest
  109.                 EXPORT        GetThePort
  110.  
  111.                 EXPORT        WindAlloc
  112.                 EXPORT        WindFree
  113.                 EXPORT        WindList
  114.                 EXPORT        WindOrigin
  115.                 EXPORT        WindSetup
  116.  
  117.                 EXPORT        AbleMenu
  118.                 EXPORT        AppRes
  119.                 EXPORT        AddNewRes
  120.                 EXPORT        BubbleUp
  121.                 EXPORT        BuildType
  122.                 EXPORT        ClearHand
  123.                 EXPORT        ConcatStr
  124.                 EXPORT        CopyRes
  125.                 EXPORT        Count1Res
  126.                 EXPORT        Count1Type
  127.                 EXPORT        CurrentRes
  128.                 EXPORT        DoListEvt
  129.                 EXPORT        DupPick
  130.                 EXPORT        ErrorCheck
  131.                 EXPORT        FileNewType
  132.                 EXPORT        FixHand
  133.                 EXPORT        GetStr
  134.                 EXPORT        Get1Index
  135.                 EXPORT        Get1IdxType
  136.                 EXPORT        Get1Res
  137.                 EXPORT        GiveEBirth
  138.                 EXPORT        HandleCheck
  139.                 EXPORT        MetaKeys
  140.                 EXPORT        NewRes
  141.                 EXPORT        PickEvent
  142.                 EXPORT        PickInfoUp
  143.                 EXPORT        PickMenu
  144.                 EXPORT        ScrapCopy
  145.                 EXPORT        ScrapEmpty
  146.                 EXPORT        ScrapPaste
  147.                 EXPORT        SetResChanged
  148.                 EXPORT        SetETitle
  149.                 EXPORT        RevertResource
  150.                 EXPORT        ShowInfo
  151.                 EXPORT        RSeedFill
  152.                 EXPORT        RCalcMask
  153.  
  154. CallOut         BSR.S        DivingBoard
  155. WindAlloc        BSR.S        DivingBoard
  156. WindFree        BSR.S        DivingBoard
  157. WindList        BSR.S        DivingBoard
  158. WindOrigin        BSR.S        DivingBoard
  159. WindSetup        BSR.S        DivingBoard
  160.  
  161. ; Common stuff
  162. AbleMenu        BSR.S        DivingBoard
  163. AppRes            BSR.S        DivingBoard
  164. AddNewRes        BSR.S        DivingBoard
  165. BubbleUp        BSR.S        DivingBoard         ;10
  166. BuildType        BSR.S        DivingBoard
  167. ClearHand        BSR.S        DivingBoard
  168. CopyRes         BSR.S        DivingBoard
  169. ConcatStr        BSR.S        DivingBoard
  170. Count1Res        BSR.S        DivingBoard
  171. Count1Type        BSR.S        DivingBoard
  172. CurrentRes        BSR.S        DivingBoard
  173. DoListEvt        BSR.S        DivingBoard
  174. DupPick         BSR.S        DivingBoard
  175. ErrorCheck        BSR.S        DivingBoard         ;20
  176. FileNewType     BSR.S        DivingBoard
  177. FixHand         BSR.S        DivingBoard
  178. GetStr            BSR.S        DivingBoard
  179. Get1Index        BSR.S        DivingBoard
  180. Get1IdxType     BSR.S        DivingBoard
  181. Get1Res         BSR.S        DivingBoard
  182. GiveEBirth        BSR.S        DivingBoard
  183. HandleCheck     BSR.S        DivingBoard
  184. MetaKeys        BSR.S        DivingBoard
  185. NewRes            BSR.S        DivingBoard         ;30
  186. PickEvent        BSR.S        DivingBoard
  187. PickInfoUp        BSR.S        DivingBoard
  188. PickMenu        BSR.S        DivingBoard
  189. RevertResource    BSR.S        DivingBoard
  190. ScrapCopy        BSR.S        DivingBoard
  191. ScrapEmpty        BSR.S        DivingBoard
  192. ScrapPaste        BSR.S        DivingBoard
  193. SetResChanged    BSR.S        DivingBoard
  194. ShowInfo        BSR.S        DivingBoard
  195. SetETitle        BSR.S        DivingBoard         ;40
  196. CallEvent        BSR.S        DivingBoard
  197. CallMenu        BSR.S        DivingBoard
  198. CallInfoUpdate    BSR.S        DivingBoard
  199. PassMenu        BSR.S        DivingBoard
  200. ResEditRes        BSR.S        DivingBoard
  201. ResEverest        BSR.S        DivingBoard
  202. GetThePort        BSR.S        DivingBoard
  203. RSeedFill        BSR.S        DivingBoard         ; 50
  204. RCalcMask        BSR.S        DivingBoard         ; 51
  205.  
  206.                 NOP
  207.  
  208. DivingBoard
  209.             LEA         CallOut+2,A1
  210.             MOVE.L        (SP)+,A0
  211.             SUB.L        A1,A0
  212.             ADD.L        A0,A0
  213.             ADD.L        ApplScratch,A0
  214.             MOVE.L        (A0),A0
  215.             JMP         (A0)
  216.  
  217.  
  218. ; Gets Res ID of self and returns it
  219. ;        FUNCTION ResEdID: INTEGER;
  220.  
  221. ResEdID
  222.             LINK        A6,#-256
  223.  
  224.             LEA         stdHeader,A0
  225.             _RecoverHandle
  226.  
  227.             MOVE.L        A0,-(SP)            ; pass handle
  228.             PEA         8(A6)                ; function result
  229.             PEA         -256(A6)            ; ignore type
  230.             MOVE.L        (SP),-(SP)            ; ignore name
  231.             _GetResInfo
  232.  
  233.             UNLK        A6
  234.  
  235.             RTS
  236.  
  237.             END 
  238.  
  239.